#include "gameData.h"
#include <stdio.h>
#include <stdarg.h>

#define GMK80MAGICNUMBER 1234321

enum WRITESTATUS {
	WRITE_SUCCESS
};
class GMK80Writer {
private:
	gameData*		dataContainer; //The structure holding the game data that will be written
	dataStream*		fileData; //The stream for writing the data to
	bool			verbose; //Verbose? (Output logging?)

	void log(const char* format, ...); //Output a message

	void writeGameSettings(dataStream *data, gameSettingsDef *dataWrite);
	void writeGameInformation(dataStream *data, gameInfoDef *dataWrite);
	void writeIncludedFile(dataStream *data, includedFilesDef *dataWrite);
	void writeTrigger(dataStream *data, triggerDef *dataWrite);
	void writeSound(dataStream *data, soundDef *dataWrite);
	void writeSprite(dataStream *data, spriteDef *dataWrite);
	void writeBackground(dataStream *data, backgroundDef *dataWrite);
	void writePath(dataStream *data, pathDef *dataWrite);
	void writeScript(dataStream *data, scriptDef *dataWrite);
	void writeFont(dataStream *data, fontDef *dataWrite);
	void writeTimeline(dataStream *data, timelineDef *dataWrite);
	void writeObject(dataStream *data, objectDef *dataWrite);
	void writeRoom(dataStream *data, roomDef *dataWrite);
	void writeNullResource(dataStream *data);
	void RecursiveTreeWrite(ResourceTreeDef* Node, int childrenCount, dataStream* stream);

public:
	GMK80Writer(gameData* dataStructure);
	WRITESTATUS writeData(dataStream* stream, bool verbose = false); //Write the data to a dataStream
};